package com.example.knowledge.mvvm.viewmodel

import androidx.lifecycle.MutableLiveData
import com.example.knowledge.api.ApiManager
import com.example.knowledge.mvvm.bean.RecordsBean
import com.example.knowledge.mvvm.bean.ReportRiskBean
import com.gsafety.library.Base.BaseViewModel
import com.gsafety.libraryktx.bean.LoadState
import com.gsafety.libraryktx.expand.enqueue
import com.gsafety.libraryktx.net.api.request.RequestParamsManager
import es.dmoral.toasty.Toasty


/**报告列表
 * @author : lj
 * @date : 2020/9/23 16:53
 */
class ReportViewModel: BaseViewModel(){
    var loadState = MutableLiveData<LoadState>()
    var mReportRiskValue = MutableLiveData<ReportRiskBean>()
    fun requestriskReport(reportName:String,reportType:String,specialsys:String,current:Int){
        enqueue(ApiManager.apiService.riskReport(RequestParamsManager.riskReport(reportName,reportType,specialsys,current)),onSuccess={ result ->
            mReportRiskValue.value = result
        },onFail={ error->
            loadState.value = LoadState.Fail(error?: "")
        })
    }





}